<template>
  <div class="classify">
    <div
      v-for="(item, index) in classText"
      :key="index"
      class="classItem"
      :class="{ act: index === currerindex }"
      @click="actBtn(index)"
    >
      <span>{{ item }} </span>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeClassify",
  props: {
    classText: {
      type: Array,
      default: ["流行", "新款", "精选"],
    },
  },
  data() {
    return {
      currerindex: 0,
    };
  },
  methods: {
    actBtn(e) {
      this.currerindex = e;
      this.$emit("showGoodsTab", e);
    },
  },
};
</script>

<style scoped>
.classify {
  width: 100%;
  display: flex;
  text-align: center;
  line-height: 44px;
  background-color: #ffffff;
  z-index: 9;
}
.classItem {
  flex: 1;
}
.act {
  color: var(--color-high-text);
}
.act span {
  border-bottom: 1px solid var(--color-high-text);
  padding: 7px;
}
</style>